package com.collectplus.express.view;

import android.annotation.SuppressLint;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class XWebView extends WebView {

	// 是否首次加载
	// private boolean first = false;

	@SuppressLint("SetJavaScriptEnabled")
	public XWebView(final Context context, AttributeSet attrs) {
		super(context, attrs);
		if (isInEditMode()) {
			// ignore
		} else {
			getSettings().setJavaScriptEnabled(true);
			// getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
			setWebViewClient(new WebViewClient() {
				@Override
				public boolean shouldOverrideUrlLoading(WebView view, final String url) {
					return super.shouldOverrideUrlLoading(view, url);
				}
			});
		}
	}

	@Override
	public void loadUrl(String url) {
		super.loadUrl(url);
		Log.d("http:web", url);
	}

}
